home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / indexing / IXWeightingDomain.h < prev    next >
Text File  |  1994-04-13  |  2KB  |  61 lines

  1. /*
  2. IXWeightingDomain.h
  3. Copyright 1991, NeXT Computer, Inc.
  4. */
  5.  
  6. #import    <objc/Object.h>
  7. #import    <objc/hashtable.h>
  8.  
  9. @class IXAttributeParser, IXAttributeTable;
  10.  
  11. @interface IXWeightingDomain: Object
  12. {
  13.     unsigned    beenRanked; // true when tokens have been ranked
  14.     unsigned    totalTokens; // the record of tokens in sample
  15.     unsigned    uniqueTokens; // record of unique tokens in sample
  16.     unsigned    indexCount; // record of entries in token index
  17.     unsigned    totalLength; // the sum of all the token lengths
  18.     void    *tokenArray; // "lexeme rank count lexeme rank count..."
  19.     unsigned    *tokenIndex; // array of offsets into token array
  20. }
  21.  
  22. - initFromDomain:(NXStream *)stream; // reads domain format
  23. - writeDomain:(NXStream *)stream; // write domain format
  24.  
  25. - initFromHistogram:(NXStream *)stream; // reads histogram format
  26. - writeHistogram:(NXStream *)stream; // writes histogram format
  27.  
  28. - initFromWFTable:(NXStream *)stream; // reads pre- 3.0 WFTable format
  29.  
  30. // initializes the weighting domain from an attribute table.
  31. - initFromAttributeTable:(IXAttributeTable *)theTable;
  32.  
  33. // The following methods initialize the weighting domain from one of the 
  34. // attributes in the supplied attribute parser.
  35.  
  36. - initFromAttributeParser:(IXAttributeParser *)aParser; // for "Default"
  37. - initFromAttributeParser:(IXAttributeParser *)aParser
  38.     forAttributeNamed:(const char *)name;
  39.  
  40. - (unsigned)totalTokens; // how many tokens were seen by parser
  41. - (unsigned)uniqueTokens; // how many unique tokens were found by parser
  42.  
  43. - (unsigned)countForToken:(void *)token // how many times did token occur
  44.     ofLength:(unsigned)aLength;
  45. - (unsigned)rankForToken:(void *)token // rank token against the others
  46.     ofLength:(unsigned)aLength;
  47.  
  48. - (float)frequencyOfToken:(void *)token // ratio token count to total count
  49.     ofLength:(unsigned)aLength;
  50. - (float)peculiarityOfToken:(void *)token // frequency relative to domain
  51.     ofLength:(unsigned)aLength andFrequency:(float)frequency;
  52.  
  53. // The following methods provide for iterating over the tokens in the domain.
  54.  
  55. - (NXHashState)initHashState;
  56. - (BOOL)nextHashState:(NXHashState *)aState 
  57.     value:(const void **)aValue length:(unsigned *)aLength;
  58.  
  59. @end
  60.  
  61.